<template>
  <div class="xiang">
    <div class="shang">
      <span class="iconfont icon-fanhui" @click="tuichu()"></span>
      <p>{{this.$store.state.banxiang.name}}详情</p>
      <div class="tou">
        <span class="iconfont icon-dian"></span>
        <div class="zhongjian"></div>
        <span class="iconfont icon-shuangyuanquan"></span>
      </div>
    </div>
    <div class="zhong">
      <div :class="xflag?'fangda':'fangdas'">
        <img :src="this.$store.state.banxiang.src" />
      </div>
    </div>
    <div class="xia">
      <h1>
        {{this.$store.state.banxiang.name}}
        <p>{{this.$store.state.banxiang.renshu}}人吃过</p>
      </h1>
      <p class="tejia">
        <span>特价</span>
        {{this.$store.state.banxiang.tejia}}
      </p>
      <p class="jieshao">{{this.$store.state.banxiang.jieshao}}</p>
      <ul class="baozhang">
        <li>
          <span class="iconfont icon-dunpai"></span>
          <p>安全保障</p>
        </li>
        <li>
          <span class="iconfont icon-dunpai"></span>
          <p>科学合理</p>
        </li>
        <li>
          <span class="iconfont icon-dunpai"></span>
          <p>食品追述</p>
        </li>
      </ul>
      <div class="jsyyfw">
        <ul>
          <li v-for="(item,index) in liat" :key="index" :class="active===index?'shao':'shaos'" @click="gaoliang(index)">{{item.name}}</li>
        </ul>
        <p>分享</p>
      </div>
      <div class="caipin">
        <Caipin :list="tive" :data="this.$store.state.banxiang.juti"/>
      </div>
    </div>
    <div class="yuyue">
      <button>预约厨师</button>
      <button>立即下单</button>
    </div>
  </div>
</template>

<script>
import Caipin from "./jieshao/caipin"

export default {
  name: "xiang",
  components:{
    Caipin
  },
  data() {
    return {
      xflag: false,
      liat: [
        {
          name: "半成品介绍"
        },
        {
          name: "营养价值"
        },
        {
          name: "服务协议"
        }
      ],
      active: 0,
      tive:1
    };
  },
  methods: {
    gaoliang(index){
      this.active=index
      this.tive=index+1
      if(index+1===3){
        this.$router.push('/fwxy')
      }
    },
    tuichu(){
      this.$emit("tuichus")
    }
  },
  mounted() {
    setTimeout(() => {
      this.xflag = true;
    }, 20);
  }
};
</script>

<style scoped>
@import url("../../../../../../assets/fonts2/iconfont.css");
.xiang {
  width: 100%;
  height: 100%;
  background: #fff;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
}
.ding {
  width: 100%;
  height: 30px;
}
.ding img {
  width: 100%;
  height: 30px;
}
.shang {
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.shang > span {
  margin-left: 10px;
}
.tou {
  width: 100px;
  height: 30px;
  background: rgba(145, 145, 145);
  border-top-right-radius: 15px;
  border-bottom-right-radius: 15px;
  border-top-left-radius: 15px;
  border-bottom-left-radius: 15px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-right: 10px;
}
.zhongjian {
  width: 1px;
  height: 60%;
  background: #fff;
}
.zhong {
  width: 94%;
  height: 200px;
  margin: 0 auto;
}
.zhong div img{
  width: 100%;
  height: 100%;
}
.fangda {
  width: 100%;
  height: 100%;
  transform: translate(0, 0) scale(1);
  transition: all 1000ms;
}
.fangdas {
  width: 100%;
  height: 100%;
  transform: translate(0, -200px) scale(0.2);
  transition: all 1000ms;
}
.xia {
  width: 94%;
  margin: 0 auto;
}
.xia h1 {
  font-size: 20px;
  line-height: 60px;
  display: flex;
  justify-content: space-between;
}
.xia h1 p {
  display: inline-block;
  font-size: 12px;
  color: rgba(126, 126, 126);
}
.xia p span {
  display: inline-block;
  padding: 0 10px;
  font-size: 15px;
  border: 1px solid red;
  color: red;
  margin-right: 5px;
}
.xia > p {
  line-height: 25px;
}
.xia .tejia {
  font-size: 15px;
}
.xia .jieshao {
  font-size: 12px;
  text-indent: 2em;
  color: rgba(126, 126, 126);
}
.xia .baozhang {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
}
.xia .baozhang li {
  margin-right: 20px;
}
.xia .baozhang li p {
  font-size: 15px;
  display: inline-block;
  color: red;
  margin-left: 5px;
}
.jsyyfw {
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: space-between;
}
.jsyyfw ul{
  height: 35px;
  background: bule;
  display: flex;
  align-items: center;
}
.jsyyfw p{
  line-height: 35px;
  color: rgba(126, 126, 126);
  font-size: 12px;
}
.jsyyfw ul li{
  margin-right: 20px;
  font-size: 15px;
}
.shaos {
  color: rgba(126, 126, 126);
}
.shao {
  line-height: 35px;
  color: #000;
  font-weight: 600;
  border-bottom: 2px solid blue;
}
.caipin{
  width: 100%;
}
.yuyue{
  width: 100%;
  height: 40px;
  position: fixed;
  bottom: 100px;
  left: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.yuyue button{
  width: 100px;
  height: 40px;
  border: none;
  outline: none;
  background: rgba(254, 164, 9);
  border-radius: 20px;
}
</style>